﻿Imports QuantumBitDesigns.Core
Imports System.Collections.ObjectModel
Imports System.Threading
Imports Hinshelwood.TFSHeatITSM.Controlers.Data.Entities
Imports Microsoft.TeamFoundation.WorkItemTracking.Client

Module TfsExtensions

    <System.Runtime.CompilerServices.Extension()> _
    Public Function GetHeatItsmId(ByVal wi As WorkItem) As Integer?
        Dim field As Field = TeamHelpers.GetWorkItemField(wi, TeamHelpers.HeatReferenceName)
        If field Is Nothing Then
            Return Nothing
        End If
        If Not IsNumeric(field.Value) Then
            Return Nothing
        End If
        Return CInt(field.Value)
    End Function



End Module